using System;
using System.Collections.Generic;
using System.Text;
using MCromwell.StaffIntranet.Task.Tasks;
using MCromwell.StaffIntranet.DTO;
using MCromwell.StaffIntranet.DependencyInjection;

namespace MCromwell.StaffIntranet.Presenters
{
    public class StaffPhotoPresenter
    {
        private IStaffViewingTask task;

        public StaffPhotoPresenter()
            : this(IoC.Resolve<IStaffViewingTask>())
        {
        }

        public StaffPhotoPresenter(IStaffViewingTask task)
        {
            if (task == null)
                throw new ArgumentNullException("task", "task cannot be null");

            this.task = task;
        }

        public byte[] RetrievePhotoFor(int Id)
        {
            StaffDTO staffDetails = task.RetrieveStaffDetailsFor(Id);
            if (staffDetails == null)
                return new byte[] { };
            else
                return staffDetails.Photo.Data;
        }
    }
}
